package cn.amossun.starter.event.property;

import lombok.Data;
import org.springframework.amqp.core.AcknowledgeMode;
import org.springframework.amqp.core.AmqpAdmin;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

@Data
public class ListenerContext {

    private final boolean exclusive;

    private final Integer priority;

    private final String concurrency;

    private final String group;

    private final Boolean autoStartup;

    private final AcknowledgeMode ackMode;

    private final AmqpAdmin amqpAdmin;

    private final int prefetchCount;

    /**
     * 根据设置的Class自动生成输入json
     * @return 设置的json Class
     */
    private final Class<?> schemaClass;

    private final boolean reTry;

    private final Map<String, Object> argumentsMap;

    private final List<String> queueNames = new ArrayList<>(4);

    public ListenerContext(boolean exclusive,
                           Integer priority,
                           String concurrency,
                           String group,
                           Boolean autoStartup,
                           AcknowledgeMode ackMode,
                           Class<?> schemaClass,
                           boolean reTry,
                           Integer prefetchCount,
                           Map<String, Object> argumentsMap,
                           AmqpAdmin amqpAdmin){
        this.exclusive = exclusive;
        this.priority = priority;
        this.concurrency = concurrency;
        this.group = group;
        this.autoStartup = autoStartup;
        this.ackMode = ackMode;
        this.schemaClass = schemaClass;
        this.reTry = reTry;
        this.prefetchCount = prefetchCount;
        this.argumentsMap = argumentsMap;

        this.amqpAdmin = amqpAdmin;
    }

}
